﻿namespace MRMDS.Module
{
    public class DebugEnvironment
    {
        private readonly GlobalManager global;

        public DebugEnvironment()
        {
            global = GlobalManager.Instance;
        }

        public void InitDebugEnvironment()
        {
            Actor actor1 = LoginAsActor("TestTokenActor1", "DebugActorUUID1");
            actor1.Info = new ActorInfo()
            {
                Name = "DebugActor1",
                Type = "Default"
            };
            actor1.State = new ActorState()
            {
                Position = new Position() { X = 116.3975f, Y = 39.90882f },
                Rotation = 0,
                Speed = 0
            };
            actor1.Command = Command.CreatMoveCommand(
                new Position() { X = 116.3975f, Y = 39.90882f },
                new Position() { X = 117.3975f, Y = 39.90882f },
                "MRMDSDebuger");
            actor1.Path = new Path()
            {
                NextPositionIndex = 0,
                PathPoints = new Position[] {
                    new Position() { X = 116.3975f, Y = 39.90882f },
                    new Position() { X = 116.3960f, Y = 39.90882f }
                }
            };
        }

        private Actor LoginAsActor(string token, string uuid)
        {
            global.Token2UUIDdic.Add(token, uuid);
            Actor actor = new Actor(uuid);
            global.UUID2Actor.Add(uuid, actor);
            return actor;
        }
    }
}